<!--
描述当前页面
-->
<script setup lang="ts">
import ScrollList from '@/components/scroll-list/index.vue'
import * as service from './service'
import { useUserStore } from '@/stores'
// TIP: store的使用
const userStore = useUserStore()
// userStore.userId = '11111'
// const userInfo = userStore.userInfo
userStore.getUserInfo()
// console.log(userInfo, userStore.userId)

const scrollListConfig = {
  apiHandler: service.getAaaaList,
  apiParams: {
    projectCode: 'siwei2520',
    shareId: '814a1880',
  },
}
const scrollListRef = ref<InstanceType<typeof ScrollList> | null>(null)

// 是否加载中
const loading = computed(() => unref(scrollListRef)?.paging.loading)

async function refreshList () {
  unref(scrollListRef)?.paging.reload() // 手动加载
}

function onRefresh () {
  console.log('回调')
}

</script>

<template>
  <scroll-list
    ref="scrollListRef"
    v-slot="slotProps"
    :config="scrollListConfig"
    @onRefresh="onRefresh"
  >
    <view v-for="(item, index) in slotProps.data" :key="index" class="item">
      {{ item.title }}
    </view>
  </scroll-list>
</template>

<style lang="scss" scoped>
.page-view {

}
</style>
